package com.carl.threadState;


/**
 * 阻塞状态
 */
public class blockThread {
    public static void main(String[] args) throws InterruptedException {

        Object o = new Object();
        Thread t1 = new Thread(()->{
            //t1线程拿不到锁资源，导致变为blocked状态
            synchronized (o){

            }
        });

        //main线程拿到obj的锁资源
        synchronized (o){
            t1.start();
            Thread.sleep(500);
            System.out.println(t1.getState());
        }

    }

}
